//
//  TapToZoomAppDelegate.m
//  TapToZoom
//
//  Created by heefan on 7/12/11.
//  Copyright 2011 heefan. All rights reserved.
//

#import "TapToZoomAppDelegate.h"
#import "RootViewController.h"

#define hLog(msg) NSLog(@"%s,%d,%@",__func__,__LINE__,msg)

@implementation TapToZoomAppDelegate

@synthesize window ;
@synthesize viewController;

/*
 * UIApplicationDelegate Protocol Reference
 *
 * Overview:
 * In addition to the user launching an application by tapping its icon, an application can be launched in
 * order to respond to a specific type of event. For example, it could be launched in response to an 
 * incoming push notificiation, it could be asked to open a file, or it could be launched to handle some
 * background event that it had requested. In all of these cases, the options dictionary passed to the 
 * application:didFinishLaunchingWithOptions: method provides information about the reason for the lunach.
 *
 * prototype : 
 * -(BOOL) application:(UIApplication *)application 
 *         didFinishLaunchingWithOptions:(NSDictionary *) launchOptions
 *
 * Discussion:
 * You should use this method to initialize your applicatiuon and prepare it for running.
 * It is called after your application has been launched and its main nib file has been loaded.
 * At the time this method is called, your application is in the inactive state. 
 * At some point after this method returns, a subsequent delegate method is called to move your application
 *  to the active (foreground) state or the background state.
 *
 * ***********
 * Important
 * ***********
 * It's highly recommended that you use this method to initialize your application and not the 
 *   applicationDidFinishLaunching: method.
 * 
 */
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
	hLog(@"enter");
	[window addSubview:viewController.view];    // add root view
	[self.window makeKeyAndVisible];
	hLog(@"exit");
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
	/*
	 Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
	 Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
	 */
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
	/*
	 Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
	 If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
	 */
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
	/*
	 Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
	 */
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
	/*
	 Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
	 */
}

- (void)applicationWillTerminate:(UIApplication *)application
{
	/*
	 Called when the application is about to terminate.
	 Save data if appropriate.
	 See also applicationDidEnterBackground:.
	 */
}

- (void)dealloc
{
	[viewController release];
	[window release];
    [super dealloc];
}

@end
